package cn.edu.scau.cmi.linzhiyang.userInterface;

import cn.edu.scau.cmi.linzhiyang.factoryMethod.AutoInsurance;
import cn.edu.scau.cmi.linzhiyang.factoryMethod.BodyPolicy;
import cn.edu.scau.cmi.linzhiyang.factoryMethod.CollPolicy;
import cn.edu.scau.cmi.linzhiyang.factoryMethod.MutipleAccidentPolicy;
import cn.edu.scau.cmi.linzhiyang.factoryMethod.PersonPolicy;
import cn.edu.scau.cmi.linzhiyang.factoryMethod.PolicyProducer;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;

public class FactoryMethodController {
	@FXML
	private Label lab_4;
	@FXML
	private ChoiceBox choicebox_1;
	@FXML
	private Button btn_1;

	@FXML
	public void initialize() {
		ObservableList<String> list = FXCollections.observableArrayList("驾驶员身体受伤", "汽车损坏", "人员伤亡", "多种事故");
		choicebox_1.setItems(list);
	}

	public void evenButton() {
		String string = (String) choicebox_1.getValue();
		PolicyProducer pp = null;
		switch (string) {
		case "驾驶员身体受伤":
			pp = new BodyPolicy();
			break;
		case "汽车损坏":
			pp = new CollPolicy();
			break;
		case "人员伤亡":
			pp = new PersonPolicy();
			break;
		case "多种事故":
			pp = new MutipleAccidentPolicy();
			break;
		default:
			break;
		}
		AutoInsurance ai = pp.getInsurObj();
		String desc = ai.getInsurInfo();
		lab_4.setText(desc);
	}

}
